package com.qf.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsAdminMapper;
import com.qf.pojo.DtsAdmin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {


    @Autowired
    private DtsAdminMapper adminMapper;

    @Override
    public List<DtsAdmin> findAdminByUserName(String userName) {
        //创建查询条件对象
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("username", userName);
        queryWrapper.eq("deleted", false); //false对应0,  true对应1

        //查询并返回结果
        List<DtsAdmin> list = adminMapper.selectList(queryWrapper);
        return list;
    }

    @Override
    public List<DtsAdmin> findAll() {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("deleted", false);
        List<DtsAdmin> list = adminMapper.selectList(queryWrapper);
        return list;
    }

}
